package com.school.entity;

/**
 * 测试类：验证系统业务逻辑与权限控制
 */
public class TestMain {
    static void main() {
        // 1. 初始化教师并开设课程
        Teacher mathTeacher = new Teacher("T001", "魏老师", "女");
        Course mathCourse = new Course("C001", "离散数学", "教学楼3203", "周三 010:00-11:40");
        mathTeacher.openCourse(mathCourse);

        Teacher javaTeacher = new Teacher("T002", "张老师", "男");
        Course javaCourse = new Course("C002", "Java程序设计", "实验楼0921", "周四 10:00-15:10");
        javaTeacher.openCourse(javaCourse);

        // 2. 初始化学生并选课
        Student student1 = new Student("2024312071", "小文", "男");
        student1.selectCourse(mathCourse);
        student1.selectCourse(javaCourse);

        Student student2 = new Student("2024312085", "小王", "男");
        student2.selectCourse(javaCourse);

        // 3. 打印教师授课信息（调用重写的printWorksheet()）
        mathTeacher.printWorksheet();
        javaTeacher.printWorksheet();

        // 4. 学生退课并打印课表
        student1.dropCourse(mathCourse);
        student1.printWorksheet();
        student2.printWorksheet();

        // 权限验证（以下代码会编译报错，验证权限控制效果）
        // 错误1：访问Course的private属性（不同包，非本类）
        // mathCourse.courseId = "C003";

        // 错误2：访问Person的protected属性（不同包，非子类）
        // javaTeacher.id = "T003";
    }
}